package com.homework.ch04;

import java.util.Random;

public class Test007 {



            public static void main(String[] args) {
                // 所有可能的字符
                String charPool = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
                Random random = new Random();
                StringBuilder code = new StringBuilder();

                // 生成4位验证码
                for (int i = 0; i < 4; i++) {
                    int index = random.nextInt(charPool.length());
                    code.append(charPool.charAt(index));
                }

                System.out.println("验证码: " + code.toString());
            }


}
